import request from '@/utils/request'

export function addDormRoom(data) {
  return request({
    url: '/dormRoom/add',
    method: 'post',
    data
  })
}

export function updateDormRoom(data) {
  return request({
    url: '/dormRoom/update',
    method: 'put',
    data
  })
}

export function deleteDormRoom(id) {
  return request({
    url: `/dormRoom/delete/${id}`,
    method: 'delete'
  })
}

export function batchDeleteDormRoom(ids) {
  return request({
    url: '/dormRoom/batchDelete',
    method: 'post',
    data: ids
  })
}

export function getDormRoomPage(params) {
  return request({
    url: '/dormRoom',
    method: 'get',
    params
  })
}

export function getDormRoomById(id) {
  return request({
    url: `/dormRoom/queryById/${id}`,
    method: 'get'
  })
}

export function getDormRoomByBuilding(buildingId) {
  return request({
    url: '/dormRoom/queryByBuilding',
    method: 'get',
    params: { buildingId }
  })
}